/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "MODULO_GRUPO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ModuloGrupo.findAll", query = "SELECT m FROM ModuloGrupo m"),
    @NamedQuery(name = "ModuloGrupo.findByModgCod", query = "SELECT m FROM ModuloGrupo m WHERE m.modgCod = :modgCod"),
    @NamedQuery(name = "ModuloGrupo.findByModgFini", query = "SELECT m FROM ModuloGrupo m WHERE m.modgFini = :modgFini"),
    @NamedQuery(name = "ModuloGrupo.findByModgNins", query = "SELECT m FROM ModuloGrupo m WHERE m.modgNins = :modgNins"),
    @NamedQuery(name = "ModuloGrupo.findByModgVac", query = "SELECT m FROM ModuloGrupo m WHERE m.modgVac = :modgVac"),
    @NamedQuery(name = "ModuloGrupo.findByModgEst", query = "SELECT m FROM ModuloGrupo m WHERE m.modgEst = :modgEst"),
    @NamedQuery(name = "ModuloGrupo.findByModgHor", query = "SELECT m FROM ModuloGrupo m WHERE m.modgHor = :modgHor"),
    @NamedQuery(name = "ModuloGrupo.findByModgExa", query = "SELECT m FROM ModuloGrupo m WHERE m.modgExa = :modgExa"),
    @NamedQuery(name = "ModuloGrupo.findByModgFfin", query = "SELECT m FROM ModuloGrupo m WHERE m.modgFfin = :modgFfin"),
    @NamedQuery(name = "ModuloGrupo.findByModgCert", query = "SELECT m FROM ModuloGrupo m WHERE m.modgCert = :modgCert"),
    @NamedQuery(name = "ModuloGrupo.findByModgNhoras", query = "SELECT m FROM ModuloGrupo m WHERE m.modgNhoras = :modgNhoras"),
    @NamedQuery(name = "ModuloGrupo.findByModgPost", query = "SELECT m FROM ModuloGrupo m WHERE m.modgPost = :modgPost"),
    @NamedQuery(name = "ModuloGrupo.findByRespCod", query = "SELECT m FROM ModuloGrupo m WHERE m.respCod = :respCod"),
    @NamedQuery(name = "ModuloGrupo.findByModgMonto", query = "SELECT m FROM ModuloGrupo m WHERE m.modgMonto = :modgMonto"),
    @NamedQuery(name = "ModuloGrupo.findByModgTarifa", query = "SELECT m FROM ModuloGrupo m WHERE m.modgTarifa = :modgTarifa"),
    @NamedQuery(name = "ModuloGrupo.findByModgFant", query = "SELECT m FROM ModuloGrupo m WHERE m.modgFant = :modgFant"),
    @NamedQuery(name = "ModuloGrupo.findByModgFpri", query = "SELECT m FROM ModuloGrupo m WHERE m.modgFpri = :modgFpri")})
public class ModuloGrupo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MODG_COD")
    private String modgCod;
    @Basic(optional = false)
    @Column(name = "MODG_FINI")
    @Temporal(TemporalType.DATE)
    private Date modgFini;
    @Column(name = "MODG_NINS")
    private Integer modgNins;
    @Basic(optional = false)
    @Column(name = "MODG_VAC")
    private int modgVac;
    @Column(name = "MODG_EST")
    private Short modgEst;
    @Column(name = "MODG_HOR")
    private String modgHor;
    @Column(name = "MODG_EXA")
    private Integer modgExa;
    @Column(name = "MODG_FFIN")
    @Temporal(TemporalType.DATE)
    private Date modgFfin;
    @Column(name = "MODG_CERT")
    @Temporal(TemporalType.DATE)
    private Date modgCert;
    @Column(name = "MODG_NHORAS")
    private Short modgNhoras;
    @Column(name = "MODG_POST")
    private Integer modgPost;
    @Column(name = "RESP_COD")
    private Integer respCod;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "MODG_MONTO")
    private Double modgMonto;
    @Column(name = "MODG_TARIFA")
    private Double modgTarifa;
    @Column(name = "MODG_FANT")
    @Temporal(TemporalType.DATE)
    private Date modgFant;
    @Column(name = "MODG_FPRI")
    @Temporal(TemporalType.DATE)
    private Date modgFpri;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "moduloGrupo", fetch = FetchType.LAZY)
    private EncuestaGrupo encuestaGrupo;
    @JoinColumn(name = "MOD_COD", referencedColumnName = "MOD_COD")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Modulo modCod;
    @JoinColumn(name = "DOCE_COD", referencedColumnName = "DOCE_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Docente doceCod;
    @JoinColumn(name = "AUL_COD", referencedColumnName = "AUL_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Aula aulCod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "moduloGrupo", fetch = FetchType.LAZY)
    private List<Horario> horarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "moduloGrupo", fetch = FetchType.LAZY)
    private List<Inscripcion> inscripcionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "moduloGrupo", fetch = FetchType.LAZY)
    private List<ModuloCalendario> moduloCalendarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modgCod", fetch = FetchType.LAZY)
    private List<Acta> actaList;
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

    public ModuloGrupo() {
    }

    public ModuloGrupo(String modgCod) {
        this.modgCod = modgCod;
    }

    public ModuloGrupo(String modgCod, Date modgFini, int modgVac) {
        this.modgCod = modgCod;
        this.modgFini = modgFini;
        this.modgVac = modgVac;
    }

    public String getModgCod() {
        return modgCod;
    }

    public void setModgCod(String modgCod) {
        String old = this.modgCod;
        this.modgCod = modgCod;
        changeSupport.firePropertyChange("modgCod", old, modgCod);
    }

    public Date getModgFini() {
        return modgFini;
    }

    public void setModgFini(Date modgFini) {
        Date old = this.modgFini;
        this.modgFini = modgFini;
        changeSupport.firePropertyChange("modgFini", old, modgFini);
    }

    public Integer getModgNins() {
        return modgNins;
    }

    public void setModgNins(Integer modgNins) {
        Integer old = this.modgNins;
        this.modgNins = modgNins;
        changeSupport.firePropertyChange("modgNins", old, modgNins);
    }

    public int getModgVac() {
        return modgVac;
    }

    public void setModgVac(int modgVac) {
        int old = this.modgVac;
        this.modgVac = modgVac;
        changeSupport.firePropertyChange("modgVac", old, modgVac);
    }

    public Short getModgEst() {
        return modgEst;
    }

    public void setModgEst(Short modgEst) {
        Short old = this.modgEst;
        this.modgEst = modgEst;
        changeSupport.firePropertyChange("modgEst", old, modgEst);
    }

    public String getModgHor() {
        return modgHor;
    }

    public void setModgHor(String modgHor) {
        String old = this.modgHor;
        this.modgHor = modgHor;
        changeSupport.firePropertyChange("modgHor", old, modgHor);
    }

    public Integer getModgExa() {
        return modgExa;
    }

    public void setModgExa(Integer modgExa) {
        Integer old = this.modgExa;
        this.modgExa = modgExa;
        changeSupport.firePropertyChange("modgExa", old, modgExa);
    }

    public Date getModgFfin() {
        return modgFfin;
    }

    public void setModgFfin(Date modgFfin) {
        Date old = this.modgFfin;
        this.modgFfin = modgFfin;
        changeSupport.firePropertyChange("modgFfin", old, modgFfin);
    }

    public Date getModgCert() {
        return modgCert;
    }

    public void setModgCert(Date modgCert) {
        Date old = this.modgCert;
        this.modgCert = modgCert;
        changeSupport.firePropertyChange("modgCert", old, modgCert);
    }

    public Short getModgNhoras() {
        return modgNhoras;
    }

    public void setModgNhoras(Short modgNhoras) {
        Short old = this.modgNhoras;
        this.modgNhoras = modgNhoras;
        changeSupport.firePropertyChange("modgNhoras", old, modgNhoras);
    }

    public Integer getModgPost() {
        return modgPost;
    }

    public void setModgPost(Integer modgPost) {
        Integer old = this.modgPost;
        this.modgPost = modgPost;
        changeSupport.firePropertyChange("modgPost", old, modgPost);
    }

    public Integer getRespCod() {
        return respCod;
    }

    public void setRespCod(Integer respCod) {
        Integer old = this.respCod;
        this.respCod = respCod;
        changeSupport.firePropertyChange("respCod", old, respCod);
    }

    public Double getModgMonto() {
        return modgMonto;
    }

    public void setModgMonto(Double modgMonto) {
        Double old = this.modgMonto;
        this.modgMonto = modgMonto;
        changeSupport.firePropertyChange("modgMonto", old, modgMonto);
    }

    public Double getModgTarifa() {
        return modgTarifa;
    }

    public void setModgTarifa(Double modgTarifa) {
        Double old = this.modgTarifa;
        this.modgTarifa = modgTarifa;
        changeSupport.firePropertyChange("modgTarifa", old, modgTarifa);
    }

    public Date getModgFant() {
        return modgFant;
    }

    public void setModgFant(Date modgFant) {
        Date old = this.modgFant;
        this.modgFant = modgFant;
        changeSupport.firePropertyChange("modgFant", old, modgFant);
    }

    public Date getModgFpri() {
        return modgFpri;
    }

    public void setModgFpri(Date modgFpri) {
        Date old = this.modgFpri;
        this.modgFpri = modgFpri;
        changeSupport.firePropertyChange("modgFpri", old, modgFpri);
    }

    public EncuestaGrupo getEncuestaGrupo() {
        return encuestaGrupo;
    }

    public void setEncuestaGrupo(EncuestaGrupo encuestaGrupo) {
        EncuestaGrupo old = this.encuestaGrupo;
        this.encuestaGrupo = encuestaGrupo;
        changeSupport.firePropertyChange("encuestaGrupo", old, encuestaGrupo);
    }

    public Modulo getModCod() {
        return modCod;
    }

    public void setModCod(Modulo modCod) {
        Modulo old = this.modCod;
        this.modCod = modCod;
        changeSupport.firePropertyChange("modCod", old, modCod);
    }

    public Docente getDoceCod() {
        return doceCod;
    }

    public void setDoceCod(Docente doceCod) {
        Docente old = this.doceCod;
        this.doceCod = doceCod;
        changeSupport.firePropertyChange("doceCod", old, doceCod);
    }

    public Aula getAulCod() {
        return aulCod;
    }

    public void setAulCod(Aula aulCod) {
        Aula old = this.aulCod;
        this.aulCod = aulCod;
        changeSupport.firePropertyChange("aulCod", old, aulCod);
    }

    @XmlTransient
    public List<Horario> getHorarioList() {
        return horarioList;
    }

    public void setHorarioList(List<Horario> horarioList) {
        this.horarioList = horarioList;
    }

    @XmlTransient
    public List<Inscripcion> getInscripcionList() {
        return inscripcionList;
    }

    public void setInscripcionList(List<Inscripcion> inscripcionList) {
        this.inscripcionList = inscripcionList;
    }

    @XmlTransient
    public List<ModuloCalendario> getModuloCalendarioList() {
        return moduloCalendarioList;
    }

    public void setModuloCalendarioList(List<ModuloCalendario> moduloCalendarioList) {
        this.moduloCalendarioList = moduloCalendarioList;
    }

    @XmlTransient
    public List<Acta> getActaList() {
        return actaList;
    }

    public void setActaList(List<Acta> actaList) {
        this.actaList = actaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (modgCod != null ? modgCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ModuloGrupo)) {
            return false;
        }
        ModuloGrupo other = (ModuloGrupo) object;
        if ((this.modgCod == null && other.modgCod != null) || (this.modgCod != null && !this.modgCod.equals(other.modgCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.ModuloGrupo[ modgCod=" + modgCod + " ]";
    }
    
    public void addPropertyChangeListener(PropertyChangeListener l){
        changeSupport.addPropertyChangeListener(null);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener l){
        changeSupport.removePropertyChangeListener(null);
    }
    
}
